
function page(type) {
    let pageNum=0;
    //得到当前页数
    let aa=$.trim($("#pageNum").val());
    let num = aa == null || aa == ""? 1 : parseInt(aa);
    num = num < 1 ? 1 : num;
    //取得总条数
    let count =$("#pageCount").html();
    let pageCount = count == null || count == ""? 1 : parseInt(count);
    //取得每一页显示的条数
    let size=$.trim($("#pageSize").val());
    let pageSize = size == null || size == ""? 10 : parseInt(size);
    pageSize = pageSize < 1 ? 10 : pageSize;
    //算出总条数
    let endPage = Math.ceil(pageCount/pageSize);

    switch (type) {
        case 'g':
            if (num > endPage){
                pageNum = endPage;
            } else {
                pageNum=num;
            }
            break;
        case 'f':
            pageNum=1;
            break;
        case 'l':
            pageNum = num ==null || num == "" ? 1: parseInt(num);
            if (pageNum>1){
                --pageNum;
            }
            break;
        case 'n':
            pageNum = num ==null || num == ""? 1 : parseInt(num);
            if(pageNum != endPage){
                ++pageNum;
            }
            break;
        case 'e':
            pageNum = Math.ceil(pageCount/pageSize);
            break;
    }
    $('#pageNum').val(pageNum);
    $('#pageSize').val(pageSize);
    findAll();
}
$(function () {
    page("g")
})